<template>
    <div>
        <a-date-picker
        format="YYYY-MM-DD"
        placeholder="开始时间"
        v-model="startValue"
        :locale="locale"
        />
        -
        <a-date-picker
        v-model="endValue"
        :locale="locale"
        format="YYYY-MM-DD"
        placeholder="结束时间"
        />
    </div>
</template>
<script>
import moment from 'moment';
import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';
export default {
    name:"selectDate",
    watch: {
        endValue() {
            this.$emit('changTime',this.startValue&&moment(this.startValue).format('YYYY-MM-DD'),this.endValue&&moment(this.endValue).format('YYYY-MM-DD'))
        },
        startValue(){
            this.$emit('changTime',this.startValue&&moment(this.startValue).format('YYYY-MM-DD'),this.endValue&&moment(this.endValue).format('YYYY-MM-DD'))
        }
    },
    data(){
        return{
            locale,
            moment,
            startValue: null,
            endValue: null,
        }
    }
}
</script>
